# from django.contrib.auth.models import User
# from django.contrib.sessions.backends.db import SessionStore
# from django.contrib.sessions.models import Session
# from rest_framework import exceptions
# from rest_framework.authentication import BaseAuthentication, SessionAuthentication
#
#
# # class Authtication(BaseAuthentication):
# from v1.models import Provincial
#
#
# class Authtication(SessionAuthentication):
#     """
#      All authentication classes should extend BaseAuthentication.
#      """
#
#     def authenticate(self, request):
#         session_id = request.GET.get('session_id')
#         if session_id:
#             try:
#                 session = Session.objects.get(session_key=session_id)
#             except Exception:
#                     raise exceptions.AuthenticationFailed({"status": "认证失败", "code": "300"})
#             uid = session.get_decoded().get('_auth_user_id')
#             user1 = User.objects.get(pk=uid)
#             return (user1, {"status": "认证成功", "code": "200"})
#     def authenticate_header(self, request):
#         """
#         Return a string to be used as the value of the `WWW-Authenticate`
#         header in a `401 Unauthenticated` response, or `None` if the
#         authentication scheme should return `403 Permission Denied` responses.
#         """
#         pass